package com.shark.mq;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @auther shark
 * @create 2024-08-04 16:53
 */
//@Component
public class MyMessageListenerBase
{

    @Value("${server.port}")
    private String serverPort;

    //hello-world
    /*@RabbitListener(queues = {"atguigu.queue.simple"})
    public void processMessage(String messageContent) {
        System.out.println("messageContent = " + messageContent);
    }*/

    //1.2 工作队列模式代码
    @RabbitListener(queues = {"atguigu.queue.work"})
    public void workMessage(String messageContent) {
        System.out.println("workMessageContent = " + messageContent+"\t"+serverPort);
    }

    //一拖2
    /*@RabbitListener(queues = {"atguigu.queue.fanout01"})
    public void processMessage01(String messageContent) {
        System.out.println("Consumer01 Message Content:" + messageContent);
    }

    @RabbitListener(queues = {"atguigu.queue.fanout02"})
    public void processMessage02(String messageContent) {
        System.out.println("Consumer02 Message Content:" + messageContent);
    }

    //4 Routing路由模式
    @RabbitListener(queues = {"atguigu.queue.direct"})
    public void processMessageRouting(String messageContent) {
        System.out.println("Message Content:" + messageContent);
    }*/


    /**
     * #：匹配零个或多个词
     * *：匹配1个词
     */
    /*@RabbitListener(queues = {"atguigu.queue.message"})
    public void processMessageTopic01(String messageContent) {
        System.out.println("Queue Message:" + messageContent);
    }

    @RabbitListener(queues = {"atguigu.queue.order"})
    public void processMessageTopic02(String messageContent) {
        System.out.println("Queue Order:" + messageContent);
    }
*/








    /*@RabbitListener(queues = {"atguigu.queue.direct"})
    public void processMessageRouting(String messageContent) {
        System.out.println("Message Content:" + messageContent);
    }*/

    /**
     * #：匹配零个或多个词
     * *：匹配1个词
     */
    /*@RabbitListener(queues = {"atguigu.queue.message"})
    public void processMessageTopic01(String messageContent) {
        System.out.println("Queue Message:" + messageContent);
    }

    @RabbitListener(queues = {"atguigu.queue.order"})
    public void processMessageTopic02(String messageContent) {
        System.out.println("Queue Order:" + messageContent);
    }
*/

}
